﻿using Owin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.Owin.StaticFiles;
using KAI.Portrait;

[assembly: Microsoft.Owin.OwinStartup(typeof(Portait.Web.Startup))]

namespace Portait.Web
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            var dir = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Portraits");

            var fullAvatarEditorHandler = new FullAvatarEditorHandler(dir, "/portraits");

            app.Map("/portrait/upload", p =>
            {
                p.Use(fullAvatarEditorHandler.Handle);
            });

            //app.Map("/portrait", p =>
            //{
            //    p.UseFileServer(new Microsoft.Owin.StaticFiles.FileServerOptions()
            //    {
            //        EnableDirectoryBrowsing = true,
            //        FileSystem = new Microsoft.Owin.FileSystems.PhysicalFileSystem(System.IO.Path.Combine(dir))
            //    });
            //});
        }
    }
}